#ifndef SCENE_H
#define SCENE_H

#include <cstdlib>

#include <QGraphicsScene>
#include <QMatrix4x4>
#include <QObject>
#include <QQueue>
#include <QTimer>

#include "ai/map.h"
#include "ai/path.h"
#include "entity/entity.h"
#include "entity/ufo.h"
#include "object/object.h"

class QGraphicsSceneMouseEvent;
class QPainter;
class QRectF;

class Flock;

class Scene : public QGraphicsScene
{
    Q_OBJECT

public:
    explicit Scene(QObject* pkParent = NULL);
    ~Scene();

    void initialize();

public slots:
    void setup();
    void step();

    void randomize();

protected:
    void drawBackground(QPainter* pkPainter, const QRectF& rkRect);
    void mousePressEvent(QGraphicsSceneMouseEvent *pkEvent);

private:
    //------------------------------------------------
    //  Attributes.
    //------------------------------------------------
    // Scene.
    QMatrix4x4     m_kCamera;
    QMatrix4x4     m_kGlobalViewCamera;
    QMatrix4x4     m_kUFOViewCamera;
    Object         m_kMapObject;
    Entity         m_kMapEntity;
    Map            m_kNavMap;
    // TODO : navmap entity.

    // UFO.
    UFO*           m_pkUFO;
    QQueue< Cow* > m_kTeleportedCows;

    // Flock.
    Flock*         m_pkFlock;

    QTimer         m_kRandomizer;
    quint32        m_uiRandomizerDelay;
};

#endif // SCENE_H
